Configure Git to use SSH Proxy with ncat
This document provides a step-by-step guide to configure Git to use an SSH proxy via ncat
, ensuring secure and efficient connections to repositories like GitHub.
Install ncat
ncat
(part of the Nmap suite) is required for proxy functionality.
# Arch Linux
sudo pacman -S nmap
# Debian/Ubuntu
sudo apt install nmap
# CentOS/RHEL
sudo yum install nmap
# macOS (via Homebrew)
brew install nmap
Configure SSH Proxy
Edit the SSH configuration file (~/.ssh/config
) to include proxy settings for your Git server.
Host github.com
User git
Hostname github.com
Port 22
ProxyCommand ncat --proxy-type socks5 --proxy 127.0.0.1:1080 %h %p
Key Parameters:
--proxy-type
: Specify proxy protocol (socks4
,socks5
, orhttp
).--proxy
: Proxy server address and port (e.g.,127.0.0.1:1080
for SOCKS5).%h %p
: Placeholders for the target host and port.
HTTP Proxy
ProxyCommand ncat --proxy-type http --proxy 127.0.0.1:8080 %h %p
Verify the Configuration
Test the SSH connection to GitHub:
ssh -T git@github.com
Hi [name] You've successfully authenticated, but GitHub does not provide shell access.
# verbose
ssh -vvT git@github.com